<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('指标信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>系统：</label>
                            <select name="sdSys" th:with="type=${@baseSd.getItem('hos_sys')}">
                                <option value=""></option>
                                <option th:each="item : ${type}" th:text="${item.na}" th:value="${item.cd}"></option>
                            </select>
                        </li>
                        <li>
                            <label>名称：</label>
                            <input type="text" name="na"/>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:index:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:index:remove')}]];
    var prefix = ctx + "md/index/index";
    var sdSysData = [[${@baseSd.getItem('hos_sys')}]];
    var valtpData = [[${@baseSd.getItem('index_valtp')}]];

    function submitHandler() {
        var rows = $("#bootstrap-table").bootstrapTable('getSelections');
        if(rows.length==0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        var idIndexs="";
        $.each(rows,function (index,item) {
            idIndexs += item.idIndex+",";
        });
        $.ajax({
            url: "/etl/dm/saveByIdIndexs/"+idIndexs.substring(0,idIndexs.length-1),
            cache: false,
            type: 'GET',
            async: false,
            dataType: 'json',
            success: function (result) {
                parent.location.reload();
                $.modal.close();
            }
        });
    }

    $(function() {
        var options = {
            url: prefix + "/notInDmList",
            exportUrl: prefix + "/export",
            modalName: "指标信息",
            columns: [{
                checkbox: true
            },
                {
                    field: 'idIndex',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'sdSys',
                    title: '系统',
                    formatter: function(value, item, index) {
                        return $.table.selectSdNaByCd(sdSysData, item.sdSys);
                    }
                },
                {
                    field: 'na',
                    title: '名称'
                },
                {
                    field: 'euTp',
                    title: '指标类型',
                    formatter: function(value, item, index) {

                        if(item.euTp==0) {
                            return "原子指标";
                        } else if(item.euTp==1) {
                            return "复合指标";
                        } else if(item.euTp==2) {
                            return "子指标";
                        }
                    }
                },
                {
                    field: 'fgAccu',
                    title: '累加标志',
                    formatter: function(value, item, index) {
                        if(item.fgAccu==1) {
                            return "可累加";
                        } else {
                            return "否"
                        }
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>